/**
 * Copyright (c) 2016-2019 九点科技 All rights reserved.
 *
 * http://www.9dyun.cn
 *
 * 版权所有，侵权必究！
 */
package com.dian.modules.sale.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dian.common.utils.MapUtils;
import com.dian.modules.sale.dao.InstallLineDao;
import com.dian.modules.sale.entity.InstallHeadEntity;
import com.dian.modules.sale.entity.InstallLineEntity;
import com.dian.modules.sale.service.InstallLineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 销售安装单明细服务实现类
 *
 * @author xiaolai
 * @email xiaolai@9dyun.cn
 * @date 2019-06-22 09:37:58
 */
@Service("InstallLineService")
public class InstallLineServiceImpl extends ServiceImpl<InstallLineDao, InstallLineEntity> implements InstallLineService {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    public InstallLineService installLineService;

    @Override
    public boolean updateInfo(InstallHeadEntity installHeadEntity) {
        List<InstallLineEntity> lineList=installHeadEntity.getInstallLineEntityList();
        this.removeByMap(new MapUtils().put("install_id", installHeadEntity.getId()));
        this.saveBatch(lineList);
        return true;

    }

    @Override
    public boolean deleteInfo(Long id) {
        return this.remove(new QueryWrapper<InstallLineEntity>().eq("install_id",id));

    }

    @Override
    public List<InstallLineEntity> queryLineList(Long id) {
        return this.list(new QueryWrapper<InstallLineEntity>().eq("install_id",id));

    }

}
